<script type="text/javascript" src="__PUBLIC__/js/showdate.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/js/jquery.js"></script>
<script type="text/javascript">
    $(function () {
        $('#container').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: '业务部工作量分布图'
            },
            xAxis: {
                categories: [ {$category} ],
                labels: {
                    rotation: -45,
                    align: 'right',
                    style: {
                        fontSize: '13px',
                        fontFamily: 'Verdana, sans-serif'
                    }
                }
            },
            tooltip: {
                formatter: function() {
                    var cdate=$('#st').val();
                    var adduser=$('#showemp').val();
                    var host = window.location.host;
                    var port = window.location.port;

                    var url="http://"+host+"__APP__/Custom/index/day/"+cdate+"/adduser/"+adduser;



                    return '<b>'+ this.x +'</b><br/>'+
                            this.series.name +': '+ this.y +'<br/>'+
                            '合计: '+ this.point.stackTotal+'<br />'+
                            '<a href="'+url+'">详细</a>';
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: '电话号码'
                }
            },
            plotOptions: {
                column: {
                    stacking: 'normal'
                }
            },


            series: [{
                    name: '客户',
                    data: [{$catedata}],
                    stack: 'female'
                },
                {
                    name: '备注',
                    data: [{$markdata}],
                    stack: 'female'
                }
            ]
        });
    });


</script>
</head>
<body>

    <script language="javascript" type="text/javascript">
        function changeemp() {
            var checkValue=$("#showemp").val();
            rebuildulr("adduser",checkValue)
           /*  var url=window.location.href;
             url=url.substr(0,url.length-5);
             url+= '/adduser/'+checkValue+'.html';
             window.location.assign(url);*/
        }
        function rebuildulr(key,val)
        {
            var myhash = {"level":"0", "adduser":"0","day":"0","type":0 };//type 0客户,1备注
            var path = window.location.pathname;
            var pos = path.lastIndexOf(".html")
            if (pos != -1)
                path = path.substring(0, pos);


            pos = path.indexOf("Custom/chart")
            var parastr = path.substring(pos + 12); //12=len("custom/index")


            if (parastr.length > 0) {
                if (parastr.substr(0, 1) == '/') parastr = parastr.substring(1);
                var arrtmp = parastr.split("/");
                for (i = 0; i < arrtmp.length / 2;) {
                    myhash[arrtmp[i]] = arrtmp[i + 1];
                    i += 2;
                }
            }

            myhash[key]=val;
            var tempstr="";

            for (key in myhash) {
                tempstr+=key +"/"+ myhash[key]+"/";
            }

            var url="__APP__/Custom/chart/"+tempstr;


            window.location.assign(url);
        }
        function dosearch()
        {
           var cdate=$('#st').val();
            rebuildulr("day",cdate);
        }
    </script>
    <style>
        * { margin: 0px; }
        body {  background-color: #ddeffd;  font-size: 12px; }
    .nav{  line-height:32px; height:32px;  border:solid 1px #ccc;display: block;}
    .nav ul{ float:left; width:800px;  }
    .nav ul li{ float:left; margin:0 15px;  }
    .nav ul li a:hover{ color:#FFF;}
    </style>
    <div class="nav">
        <ul>
            <li>选择员工
                <select name="select" id="showemp" keepDefaultStyle="true" onChange="changeemp();">
                    <option value="0">选择</option>
                    <volist name="emp_list" id="vo">
                        <option value="{$vo['id']}"
                        <?php if(I('get.adduser')==$vo['id']) echo "selected" ?>>{$vo['name']}</option>
                    </volist>
                </select>
            </li>
            <li>
                日期:<input type="text" id="st" name="st" onclick="return Calendar('st');" value="<?php $day=I('get.day');
                if(empty($day))
                echo date('Y-m-d');
                else
                echo $day;
                ?>" class="text"
                          style="width:85px;"   />
                <input type="button" value="查询"  onclick="dosearch();" />
            </li>
        </ul>
    </div>
    <script src="__PUBLIC__/highchart/js/highcharts.js"></script>

    <div id="container" style="min-width: 500px; height: 400px; margin: 0 auto"></div>
</body>
</html>